﻿namespace Quail
{
    /// <summary>
    /// Wraps a A tag html control
    /// </summary>
    public class WebLink : WebControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="WebLink"/> class.
        /// </summary>
        /// <param name="container">The owning control or page.</param>
        /// <param name="selector">The jQuery selector.</param>
        public WebLink(WebControlContainer container, string selector)
            : base(container, selector)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="WebLink"/> class.
        /// </summary>
        /// <param name="control">The control to copy from.</param>
        public WebLink(WebControl control)
            : base(control)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="WebLink"/> class.
        /// </summary>
        public WebLink()
        {
        }

        /// <summary>
        /// Gets the link's REL attribute
        /// </summary>
        public string Rel
        {
            get { return Attr(KnownAttribute.Rel); }
        }

        /// <summary>
        /// Gets the link's HREF attribute
        /// </summary>
        public string Href
        {
            get { return Attr(KnownAttribute.Href); }
        }

        /// <summary>
        /// Gets the link's HREF in absolute form
        /// </summary>
        public string HrefAbsolute
        {
            get { return Attr(KnownAttribute.HrefAbsolute); }
        }

        /// <summary>
        /// Gets the link's text
        /// </summary>
        public string Text
        {
            get { return InnerText; }
        }

        /// <summary>
        /// Gets the link's target
        /// </summary>
        public string Target
        {
            get { return Attr(KnownAttribute.Target); }
        }
    }
}
